-
Notifications
You must be signed in to change notification settings - Fork 0
/
ls_sound_mock.py
78 lines (55 loc) · 1.6 KB
/
ls_sound_mock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
# Simple test script that plays (some) wav files
from __future__ import print_function
import time
from audio_dsp_sample import *
import _thread
WAV_DEFAULT = './music/canon.mid'
class LsSound(object):
running = False
recoding = False
inp = None
notes = set()
note = 0
device = None
def __init__(self, device=None):
pass
def device_init(self):
pass
def playToDevice(self, device, f):
pass
def play(self, wav_name=WAV_DEFAULT):
pass
def play_loop(self, wav_name=WAV_DEFAULT):
pass
def record_loop(self, msg):
pitches = iter(midi_pitch_from_mic(50))
while True:
print('start recording')
note = next(pitches)
try:
if note < 35 or note > 80:
continue
self.note = int(note)
# self.notes.clear()
# self.notes.add(note)
print('note=', int(note))
except:
pass
def start_record(self):
if not self.running:
self.running = True
#_thread.start_new_thread(self.record_loop, ('',))
def stop(self):
pass
def usage(self, ):
print('usage: playwav.py [-d <device>] <file>', file=sys.stderr)
sys.exit(2)
if __name__ == '__main__':
# pitches = iter(midi_pitch_from_mic(100))
# while True:
# x =next(pitches)
# print(x)
s = LsSound()
s.start_record()
time.sleep(300)