gundy / tiny-synth

Verilog code for a simple synth module; developed on TinyFPGA BX
Other
94 stars 10 forks source link

No audio output #1

Closed lawrie closed 5 years ago

lawrie commented 5 years ago

I am having difficulty getting any audio output using your code unchanged on a TinyFPGA. My speaker setup on PIN_1 works fine for designs that just do simple tone output and I have used the same setup a lot on my myStorm FPGA with various audio output. The problem seems to be the 1Mhz carrier frequency. I tried using the low-pass filter as described in your README file. Looking at the output using an oscilloscope, when the 1Mhz signal is filtered out, the 1Khz frequency voltage is also drastically reduced so I get nothing through the speakers. I tried building an active low-pass filter with an op amp, but that did not work either. I did try putting putting it through a stereo amplifier, selecting an input with a preamp, and turning the volume up. I got some sound that way, mainly a rhythmic beating sound, but not what I was expecting.

What should the output sound like?

Do you have any suggestions of what I should try?

Are you on the TinyFPGA forum? It might be better to discuss this there.

gundy commented 5 years ago

Hi,

For clarity I was using the 16MHz clock for the output DAC, and the 1MHz clock for driving the oscillators.

If you'd like to hear what it sounds like here, I have captured the output from the triangle oscillator in Reaper, and uploaded it to soundcloud.

The spectrum in reaper looked like this:

c3-triangle-fpga

I'll jump on the forum in a bit..

gundy commented 5 years ago

Also, I did come across something a little odd this morning while I was playing with something else - namely that apio build seemed to be picking random modules to use as the "top-level" module (and it seems like it's not possible to pass in the actual top module name).

I'll do some more digging on all of this today and see if I can figure out what might be going on for you..

tinyfpga commented 5 years ago

File a bug on APIO with a reproducible test case if you can. Their own issue tracker will have much more visibility for them.

On Wed, Aug 1, 2018 at 4:59 PM gundy notifications@github.com wrote:

Also, I did come across something a little odd this morning while I was playing with something else - namely that apio build seemed to be picking random modules to use as the "top-level" module (and it seems like it's not possible to pass in the actual top module name).

I'll do some more digging on all of this today and see if I can figure out what might be going on for you..

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gundy/tiny-synth/issues/1#issuecomment-409762640, or mute the thread https://github.com/notifications/unsubscribe-auth/AcnVg_Y1Hh5uvcLon0cwYhv-W3DibYP3ks5uMkDigaJpZM4VrHSz .

gundy commented 5 years ago

Okay - so I think I may have figured out what was going on - the envelope generator code was flaky and wasn't producing the correct amplitude to modulate with the tone generator :(.

I guess that's what happens when you're learning verilog as you go :)

I figured this out as I was trying to wire an external pin up to the trigger to generate some noise.

I think I've fixed it, and I've also changed the top module code so that you can "trigger" the voice by bridging PIN_13 with ground.

BTW, the top module has been renamed to zztop.v so it comes last in my build script.

Let me know if any of that has helped. If not, I'm more than happy to help dig deeper.

This is an example of the noise that I was able to produce using the code now:

tiny-synth saw enveloped

lawrie commented 5 years ago

I am definitely getting some output now. It doesn't seem any different whether I use a low-pass filter or not:

https://www.youtube.com/watch?v=evm8iYwh9G8

gundy commented 5 years ago

Okay, great! That's progress! Your sample sounds pretty much the same as my video above, so I think things are working.

Regarding the low-pass filter: your equipment will likely filter the output anyway (eg. there's no way your speaker will be able to reproduce sounds much above ~20kHz - let alone the 16MHz modulation frequency).

It's still probably 'safest' to remove those high frequency signals though as they might limit performance in the audio passband.

lawrie commented 5 years ago

My oscilloscope and the guitar tuning app on my phone reported the frequency as 65hz. I multiplied tone_freq by about 4 and then got a frequency of 245hz, so it appears to be working. My oscilloscope shows the low-pass filter cleaning up the signal, but for the reasons you say, it doesn't sound much different.

gundy commented 5 years ago

Glad to hear it's all working as expected :). I'm going to close this off now.