Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No audio output #1

Closed
lawrie opened this issue Aug 1, 2018 · 8 comments
Closed

No audio output #1

lawrie opened this issue Aug 1, 2018 · 8 comments

Comments

@lawrie
Copy link
Contributor

lawrie commented Aug 1, 2018

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
Copy link
Owner

gundy commented Aug 1, 2018

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
Copy link
Owner

gundy commented Aug 1, 2018

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
Copy link

tinyfpga commented Aug 2, 2018 via email

@gundy
Copy link
Owner

gundy commented Aug 2, 2018

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
Copy link
Contributor Author

lawrie commented Aug 2, 2018

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
Copy link
Owner

gundy commented Aug 2, 2018

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
Copy link
Contributor Author

lawrie commented Aug 2, 2018

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
Copy link
Owner

gundy commented Aug 11, 2018

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

@gundy gundy closed this as completed Aug 11, 2018
gundy added a commit that referenced this issue Aug 12, 2018
…his makes mixing and volume scaling logic a lot simpler.
gundy added a commit that referenced this issue Aug 12, 2018
Optimisation pass #1: Update code to use signed samples internally; t…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants