Skip to content

Commit

Permalink
Adding an architecture check (number of cpu cores)
Browse files Browse the repository at this point in the history
  • Loading branch information
bishoph committed Nov 12, 2017
1 parent a34841f commit 5524963
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sopare/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.3.9"
__version__ = "1.4.0"

10 changes: 9 additions & 1 deletion test/test_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
under the License.
"""

import multiprocessing
import unittest
import pyaudio
import audioop
import math

class test_audio():
class test_audio(unittest.TestCase):

SAMPLE_RATES = [ 8000, 11025, 12000, 16000, 22050, 32000, 44100, 48000 ]
CHUNKS = [ 512, 1024, 2048, 4096, 8192 ]
Expand Down Expand Up @@ -70,6 +72,9 @@ def read(self, chunks, loops):
print ("Error: "+ str(e))
return test_result

def test_environment(self):
self.assertGreaterEqual(multiprocessing.cpu_count(), 4, 'SOPARE requires a multiprocessor architecture and was tested with at least 4 cores (e.g. RPi2/3)')

def test_sample_rates(self):
print ('testing different SAMPLE_RATEs ... this may take a while!\n\n')
for test_sample_rate in test_audio.SAMPLE_RATES:
Expand Down Expand Up @@ -112,8 +117,11 @@ def test_results(self):
print ('THRESHOLD = '+str(treshold))
else:
print ('No recommendations, please fix your environment and try again!')
print ('However, here are the sucessful tested sample rates:')
print (str(test_audio.TEST_RESULTS))

ta = test_audio()
ta.test_environment()
ta.test_sample_rates()
ta.test_chunks()
ta.test_results()

0 comments on commit 5524963

Please sign in to comment.