FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits

help on Music Synthesizer

Altera_Forum
Honored Contributor II
938 Views

Hi everyone,  

 

Has anyone encountered using the starter code on Terasic website for the implementation of the DE2 board Music Synthesizer? I was wondering how they came up with the demo_sound block codes, key codes etc. I think that there is a formula for figuring out the frequency for the notes but they are only in hexadecimal. Thanks in Advance! 

 

Here is the snippet of the code: 

 

/////////// note list /////////// 

always @(step) begin 

case (step) 

0:TT=8'h1a; 

1:TT=8'h97; 

2:TT=8'hf6; 

3:TT=8'h35; 

4:TT=8'h84; 

5:TT=8'h13; 

6:TT=8'h12; 

7:TT=8'h31; 

8:TT=8'h85; 

9:TT=8'h36; 

10:TT=8'h86; 

11:TT=8'h37; 

12:TT=8'h87; 

13:TT=8'h3a; 

14:TT=8'h8a; 

15:TT=8'h8a; 

16:TT=8'h87; 

17:TT=8'h86; 

18:TT=8'h85; 

19:TT=8'h95; 

20:TT=8'hf4; 

21:TT=8'h83; 

22:TT=8'h8a; 

23:TT=8'h8a; 

24:TT=8'h87; 

25:TT=8'h86; 

26:TT=8'h85; 

27:TT=8'h95; 

28:TT=8'hf4; 

29:TT=8'h83; 

30:TT=8'h83; 

31:TT=8'h83; 

32:TT=8'h83; 

33:TT=8'h83; 

34:TT=8'hf3; 

35:TT=8'hf4; 

36:TT=8'h35; 

37:TT=8'hf4; 

38:TT=8'hf3; 

39:TT=8'h82; 

40:TT=8'h82; 

41:TT=8'h82; 

42:TT=8'hf2; 

43:TT=8'hf3; 

44:TT=8'h34; 

45:TT=8'hf3; 

46:TT=8'hf2; 

47:TT=8'h81; 

48:TT=8'h1a; 

49:TT=8'h86; 

50:TT=8'h95; 

51:TT=8'hf4; 

52:TT=8'h83; 

53:TT=8'h84; 

54:TT=8'h13; 

55:TT=8'h12; 

56:TT=8'h21; 

57:TT=8'h1f;//end 

endcase 

end 

assign step_r=57;///Total note
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
250 Views

The key notes are related to the phase increment which is required to drive a pointer for direct digitial synthesis, shortend "DDS". See the wiki for this. According to the sample speed of the FPGA synthesizer module, a pointer is continously increased- the larger the value, the higher the freqency. 

 

But a remark: 

 

For musical applications DDS is not sufficiant. Apart from a very fine resolution and interpolation - phase dithering and filtering has to be applied in order to obtain good sine waves to derive harmonics and realistic generic waves from it. If you do this correctly the size of design becomes large and thus expensive quickly. I prefer VA Modelling for sound synthesis. 

 

http://www.96khz.org/htm/synthesizerstructure.htm
0 Kudos
Reply