TV_out synth

Store Forums Hackvision Game Development TV_out synth

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #692

    Its going to be / do something like this.

    The aim is to enable noise in Hackvision games.

    http://www.youtube.com/watch?v=IAVWaAS_2vQ&feature=youtube_gdata_player

    This is emulation still, the real deal will be a DDS synth hooked to hbi_hook at 7811 hz.

    #1920
    Michael
    Keymaster

    Have you actually tried that on a Hackvision or Arduino though? Are you doing all that with square waves? You can only generate square waves with PWM.

    #1921

    Well, yes and no. I’m trying it out on the Hackvision at the moment.

    As for the square waves, the concept is as follows:

    Timer2 is fastPWM’ing at 62,5 kHz, mode 3 (counting to fixed 0xFF)

    A function is hooked to horizontal blank interrupt (TV.set_hbihook). This function manipulates the duty cycle OCR2A of timer2, allowing the output voltage of the pin11 to be between 0 (0 duty) to 4,92V (OCR2A = 255 = 100% duty). Hbi fires at 7811 hz, meaning I get to choose the output PWM duty at that resolution = allows to make rudimentary sawtooth, triangle etc waves. In effect, the timer2 PWM is a DAC. This is a well known concept with Arduino audio, but I haven’t seen anyone combine it with TV_out. One reason for this is that you get a much quieter signal level out than with the method used by tv.tone. But since Hackvision is connected to a TV with possibility of amplification, I thought it just might work.

    You can see the PWM (sawtooth wave) overflowing from 255 to 0 in this image from my USB scope

    Apologies for lecturing on a subject you´re probably much more familiar with than I am.

    The real problem, however, is that I have troubling interference with the video signal (horizontal stripes and image cutting at the last row), I’ll post an image of it soon.

    #1922

    You can see the interference that I am getting in this image.

    Here timer2 is generating a sawtooth wave at approx 30hz. PWM is at 62,5 kHz

    I’m thinking of 2 solutions:
    1) filter the sound signal in hardware (wouldn’t like to do this, because its incompatible with Hackvision)
    2) increase frequency of PWM dramatically by using fast PWM mode 7 and setting TOP lower. I could get 125 kHz by setting top to 128, but naturally I will lose half the resolution.
    3) it is also possible that duty = 0 % and/or duty=100% is causing the interference, because they are such extreme cases.

    #1923
    Michael
    Keymaster

    allowing the output voltage of the pin11 to be between 0 (0 duty) to 4,92V (OCR2A = 255 = 100% duty)

    You keep implying that the voltage can be between 0 and 5V. It cannot. The actual voltage on the pin at any given time can be either 0 or 5V. A PWM pin simply toggles between these 2 voltages at different rates and duty cycles, but it is NOT a DAC. The guy on the arduino.cc forum told you that a 50% duty cycles gives you 2.5V, but that’s just wrong.

    I’m not saying that you can’t do some good sound, but you are limited to square waves.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.