Code Monkey home page Code Monkey logo

audio-effects's Introduction

audio-effects

Audio processing on a DE2-70 FPGA. The implementation follows the following diagram:

Diagram

To generate Verilog do:

make run

To run a simulation do:

make test

Note: Some tests require a sound file in the root directory named sample.wav.

To quickly see waveforms from simulation do:

make wave

or simulate and waveforms in one command:

make test wave

More options for configuring make targets can be specified in a config.mk file. An example could be:

TESTTARGET = audio.AudioProcessingFrameSpec
WAVETARGET = test_run_dir/AudioProcessingFrame_should_play/AudioProcessingFrame.vcd
WAVECONFIG = test_run_dir/wave.gtkw
DIAGRAMTARGET = $(CURDIR)/build/FIRFilter.fir
DIAGRAMMERDIR = ~/repos/diagrammer

The signal path is defined in src/main/scala/audio/DSPModules.scala:

class DSPModules {
  // Specify which effects to use
  var effects: List[DSPModule] = List(
    Module(new NoiseGate(0xc0, false, 16)),
    Module(new ClampDistortion(16, true, 16)),
    Module(new MovingAverage(16, true)),
    Module(new VolumeControl(32, false))
  )
}

This would create the signal path: -> NoiseGate -> ClampDistortion -> MovingAverage -> VolumeControl.

You can specify whether or not to use stereo in src/main/scala/Top.scala by setting the boolean argument:

object Main extends App {
  // Generate the Verilog output
  emitVerilog(new Top(stereo = true), args)
}

Using stereo will obviously use more hardware, but in some cases it is necessary for high quality audio.

To program the FPGA, plug in your DE2-70 development board via USB blaster and make sure you have Quartus 13 installed. Run the following command:

make program

Plug in an AUX cable to the LINE IN plug and either a speaker or headphones to the LINE OUT plug. Play some audio and you should hear it come through. Make sure to unplug the USB blaster after programming the FPGA since it can introduce noise into the signal path. If the audio does not come through right away you might need to press KEY0 (reset) a few times.

audio-effects's People

Contributors

madsrumlenordstrom avatar hongjumeow avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.