Générateur de fichier .wav à partir d'un fichier .k7 pour Thomson TO7/70.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
774 B

#!/usr/bin/env python
import wave
AMPLITUDE = 2 ** 15
#w = wave.open( "out.wav", "w" )
#w.setnchannels( 2 )
#w.setsampwidth( 2 ) #BYTES
#w.setframerate( 22000 )
from array import array
import math
F = 261.626
F2 = F * (2 ** (5 / 12.))
ang = 0.0
ang2 = 0.0
delta = ( math.pi * 2 * F ) / 22000.0
delta2 = ( math.pi * 2 * F2 ) / 22000.0
for cycle in xrange( 4 ):
data = array( 'h' )
for pos in xrange( 22000 ):
amp = AMPLITUDE * (pos / 22000.0)
amp2 = AMPLITUDE - amp
if cycle & 1:
amp, amp2 = amp2, amp
print int( ( amp * math.sin( ang ) ) )
print int( ( amp2 * math.sin( ang2 ) ) )
ang += delta
ang2 += delta2
# print data.tostring()
# w.writeframes( data.tostring() )
#w.close()