MOSS: a small, mostly 3D-printed litter-picking rover. Cleaner streets, one maker at a time.
Python
Keep only music in the MOSS harness film
metrox-eth6f66ef046f5c
diff --git a/hardware/electronics/moss-core-v0.7/harness/MANIFEST.json b/hardware/electronics/moss-core-v0.7/harness/MANIFEST.jsonindex 79b266f..da3615d 100644--- a/hardware/electronics/moss-core-v0.7/harness/MANIFEST.json+++ b/hardware/electronics/moss-core-v0.7/harness/MANIFEST.json@@ -211,8 +211,8 @@"bytes": 481},"evidence/AUDIO_QA.json": {- "sha256": "0316fff921e297a76fcf8ff90a2c26758edae67259b9e05dcdf0e636cfac82b9",- "bytes": 2395+ "sha256": "2b0e45120008214aae1c33e4f500916d7d0d7ebdbd205e03ad2088157588d797",+ "bytes": 1075},"evidence/CONNECTION_CHECKS.json": {"sha256": "aa8fd10b679caf9bd5e6a3c5176c419b149278370393ef3bfe736b6b91a0188f",@@ -226,13 +226,17 @@"sha256": "7b002e58fa1866c9e4a16e262907f7dcc4b6185aaaea29ce15adae02c1af99ab","bytes": 19716},+ "evidence/MUSIC_ONLY_QA.json": {+ "sha256": "0333d89c54d30e999b89ea37e4787fa28f4d224ac4401b08423bdec9e89b7e49",+ "bytes": 425+ },"evidence/PUBLIC_BUILD_QA.json": {- "sha256": "089fd005b0e5863e18c11c4c104e987b172be25bedd94929ee9895b6936b3448",- "bytes": 576+ "sha256": "8f9b34b32ce2499cd08171b0365db7654495957c1f147a041fd941073909145a",+ "bytes": 652},"evidence/RENDER_QA.json": {- "sha256": "352716ac2baf3d0a887b1749160683997072e77aa317755687849f9324851113",- "bytes": 2055+ "sha256": "5bf3df4d0c30180eb10ece66474981d346aaef165ce9644cd4ee4de603d1acde",+ "bytes": 2131},"evidence/ROUTING_CLEARANCE_SCREEN.json": {"sha256": "9492f81b50b65bffa35d86e27af2593a68acca4d1d5fa51c2358bc184bceb7d3",@@ -259,8 +263,8 @@"bytes": 117882},"media/MOSS_Harness_Story.mp4": {- "sha256": "efc112fabf5b75d1eaca01dc8f95502f8644b7801f1f0ccf4ddf6c722353b42b",- "bytes": 12340158+ "sha256": "66e3aeeb2182d65df1dac40898d6dbe04ac8a3459cb961c49b46556078486417",+ "bytes": 12342239},"media/MOTOR_CONNECTOR.jpg": {"sha256": "3e70c5c3d3ab029c014fe821609a048caeb4cf1b42d4f68536faf85cf7228c69",@@ -287,8 +291,8 @@"bytes": 24410},"source/README.md": {- "sha256": "dc0a64663532a25e4166fc695637c5818602579d32f8c5ebf9f15fcccc9a03e5",- "bytes": 1922+ "sha256": "a721b14032abe3357905d6742d546f359c95df4060c814064750f2b0e99d3539",+ "bytes": 1931},"source/ROUTE_CONTROL_POINTS.json": {"sha256": "eb9d481ef122d127b79168508fc434c2519743c0eac98a807980e0a2a49d060f",@@ -315,8 +319,8 @@"bytes": 8103},"source/make_story_audio.py": {- "sha256": "d5ab0ff47f2dd858bcbb8497be488a40950317fe138eefed1b1e5534523d0e83",- "bytes": 4921+ "sha256": "efbfbc8cbd1534334c5c65d0937f2c5d2d4e709bb6700b8363719de3146d7b9e",+ "bytes": 2848},"source/render_harness.py": {"sha256": "e6968f3a112637cd689cfa169952ad2af7c693a1a43600ddc88359d05a4c006c",diff --git a/hardware/electronics/moss-core-v0.7/harness/evidence/AUDIO_QA.json b/hardware/electronics/moss-core-v0.7/harness/evidence/AUDIO_QA.jsonindex 4294833..09e1a4a 100644--- a/hardware/electronics/moss-core-v0.7/harness/evidence/AUDIO_QA.json+++ b/hardware/electronics/moss-core-v0.7/harness/evidence/AUDIO_QA.json@@ -18,16 +18,15 @@"rms_dbfs": -30.553511231752726},"effects": {- "peak_dbfs": -14.0,- "rms_dbfs": -34.62859983863577+ "present": false},"mix_float": {- "peak_dbfs": -11.46877057250835,- "rms_dbfs": -29.121511392198485+ "peak_dbfs": -17.165705827358956,+ "rms_dbfs": -30.553511231752726},"mix_wav_readback": {- "peak_dbfs": -11.468837638748093,- "rms_dbfs": -29.121777111135046+ "peak_dbfs": -17.165968661175025,+ "rms_dbfs": -30.55377703512971},"clipped_samples": 0,"first_sample": [@@ -48,66 +47,8 @@42]},- "effects_original_synthesis": true,+ "effects_original_synthesis": false,"speech_or_tts": false,- "sound_family_reference": "sound_effects.py",- "events": [- {- "time_seconds": 3.1,- "duration_seconds": 0.34,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- },- {- "time_seconds": 7.15,- "duration_seconds": 0.34,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- },- {- "time_seconds": 10.2,- "duration_seconds": 0.34,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- },- {- "time_seconds": 14.1,- "duration_seconds": 0.34,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- },- {- "time_seconds": 22.1,- "duration_seconds": 0.34,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- },- {- "time_seconds": 26.65,- "duration_seconds": 0.34,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- },- {- "time_seconds": 30.15,- "duration_seconds": 0.44,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- },- {- "time_seconds": 35.1,- "duration_seconds": 0.44,- "cue": "soft transition cue",- "cue_peak_dbfs": -14.0,- "pan": 0- }- ],- "sha256": "562989d8c7597898126cebac3d9db9be30f7f5a0504e0e51c8938c87b9e588fe"+ "events": [],+ "sha256": "6a8a11a3788d3f0dd56925c5d98d7b1f490fae4affce225739634cef3b8fbeac"}diff --git a/hardware/electronics/moss-core-v0.7/harness/evidence/MUSIC_ONLY_QA.json b/hardware/electronics/moss-core-v0.7/harness/evidence/MUSIC_ONLY_QA.jsonnew file mode 100644index 0000000..2802e82--- /dev/null+++ b/hardware/electronics/moss-core-v0.7/harness/evidence/MUSIC_ONLY_QA.json@@ -0,0 +1,18 @@+{+ "change": "Removed all added electronic beeps; music only.",+ "seconds": 42,+ "video_bitstream_unchanged": true,+ "video_stream_hash": "SHA256=c6ad828f2fb105633ad57a3b861f4589008ccc663513771a4091028cfc128cc6",+ "sha256": "66e3aeeb2182d65df1dac40898d6dbe04ac8a3459cb961c49b46556078486417",+ "music_gain": 0.462,+ "fades_seconds": {+ "in": [+ 0,+ 0.5+ ],+ "out": [+ 40.5,+ 42+ ]+ }+}diff --git a/hardware/electronics/moss-core-v0.7/harness/evidence/PUBLIC_BUILD_QA.json b/hardware/electronics/moss-core-v0.7/harness/evidence/PUBLIC_BUILD_QA.jsonindex 8a6abfe..4b261b3 100644--- a/hardware/electronics/moss-core-v0.7/harness/evidence/PUBLIC_BUILD_QA.json+++ b/hardware/electronics/moss-core-v0.7/harness/evidence/PUBLIC_BUILD_QA.json@@ -5,6 +5,7 @@"routes_sha256": "ced60cb6321cad7a4edc1983807427f520afecd069c392940326b95cadebba9a","missing_relative_links": [],"private_absolute_path_hits": [],- "video_sha256": "efc112fabf5b75d1eaca01dc8f95502f8644b7801f1f0ccf4ddf6c722353b42b",- "viewer_zip_sha256": "7992a80c204cb83bb17985d9b80dc35ebce22cfa34e9943fddd93edfa825acc2"+ "video_sha256": "66e3aeeb2182d65df1dac40898d6dbe04ac8a3459cb961c49b46556078486417",+ "viewer_zip_sha256": "7992a80c204cb83bb17985d9b80dc35ebce22cfa34e9943fddd93edfa825acc2",+ "audio_edit": "Music only, added beeps removed; video stream unchanged."}diff --git a/hardware/electronics/moss-core-v0.7/harness/evidence/RENDER_QA.json b/hardware/electronics/moss-core-v0.7/harness/evidence/RENDER_QA.jsonindex 60a7c93..89f18b0 100644--- a/hardware/electronics/moss-core-v0.7/harness/evidence/RENDER_QA.json+++ b/hardware/electronics/moss-core-v0.7/harness/evidence/RENDER_QA.json@@ -73,5 +73,6 @@"elapsed_s": 93.33503890037537,"frames": 1008,"video_decode": "Full final H.264/AAC stream decoded by FFmpeg without errors",- "video_sha256": "efc112fabf5b75d1eaca01dc8f95502f8644b7801f1f0ccf4ddf6c722353b42b"+ "video_sha256": "66e3aeeb2182d65df1dac40898d6dbe04ac8a3459cb961c49b46556078486417",+ "audio_edit": "Music only, added beeps removed; video stream unchanged."}diff --git a/hardware/electronics/moss-core-v0.7/harness/media/MOSS_Harness_Story.mp4 b/hardware/electronics/moss-core-v0.7/harness/media/MOSS_Harness_Story.mp4index aa02c9a..7edf8d9 100644Binary files a/hardware/electronics/moss-core-v0.7/harness/media/MOSS_Harness_Story.mp4 and b/hardware/electronics/moss-core-v0.7/harness/media/MOSS_Harness_Story.mp4 differdiff --git a/hardware/electronics/moss-core-v0.7/harness/source/README.md b/hardware/electronics/moss-core-v0.7/harness/source/README.mdindex 689ca2f..cf571b4 100644--- a/hardware/electronics/moss-core-v0.7/harness/source/README.md+++ b/hardware/electronics/moss-core-v0.7/harness/source/README.md@@ -22,6 +22,6 @@ MOSS_MUSIC=/absolute/path/to/your/licensed-music.m4a python source/make_story_aupython source/render_story.py```-The film uses VTK camera motion and lighting, with Pillow for the existing MOSS graphics and FFmpeg for encoding. It streams frames straight to the encoder rather than saving a large image sequence. The STOP/battery callout shot has a stationary camera; callout endpoints are projected from model coordinates. The soundtrack source is not bundled; use music you have permission to use. Original short electronic transition cues are generated by the script.+The film uses VTK camera motion and lighting, with Pillow for the existing MOSS graphics and FFmpeg for encoding. It streams frames straight to the encoder rather than saving a large image sequence. The STOP/battery callout shot has a stationary camera; callout endpoints are projected from model coordinates. The soundtrack source is not bundled; use music you have permission to use. The current soundtrack contains music only, with no generated transition beeps.The offline viewer is a Three.js bundle with the GLB embedded. Bundle checks verify the GLB container, embedded resources and JS compilation. This publication does not claim an automated interactive browser acceptance test.diff --git a/hardware/electronics/moss-core-v0.7/harness/source/make_story_audio.py b/hardware/electronics/moss-core-v0.7/harness/source/make_story_audio.pyindex ba43b89..71ec2a5 100644--- a/hardware/electronics/moss-core-v0.7/harness/source/make_story_audio.py+++ b/hardware/electronics/moss-core-v0.7/harness/source/make_story_audio.py@@ -1,4 +1,4 @@-"""Deterministic MOSS music + original friendly electronic cues; no speech samples."""+"""MOSS music-only soundtrack, retaining the approved gain and fades."""from pathlib import Pathimport hashlibimport json@@ -16,59 +16,20 @@ SR, DURATION = 48000, 42MUSIC_GAIN = 1.4 * .33ROOT.mkdir(parents=True, exist_ok=True)-def note(midi, duration=.14, glide=0, vibrato=0):- t = np.arange(round(SR * duration)) / SR- freq = 440 * 2 ** ((midi - 69) / 12)- frequency = freq * 2 ** ((glide*t/duration + vibrato*np.sin(2*np.pi*8*t))/12)- phase = 2*np.pi*np.cumsum(frequency)/SR- # Same soft sine/harmonic family as the earlier MOSS film, with subtle portamento.- tone = np.sin(phase) + .14*np.sin(2*phase) + .04*np.sin(3*phase)- envelope = np.minimum(t/.009, 1) * np.minimum(np.maximum(duration-t, 0)/.035, 1)- envelope *= np.exp(-t*2.4)- return tone * envelope--def phrase(notes, lengths, spacing, glide=0, vibrato=0):- n = round((spacing*(len(notes)-1)+max(lengths)+.11)*SR)- out = np.zeros(n)- for i, (pitch, duration) in enumerate(zip(notes, lengths)):- signal = note(pitch, duration, glide, vibrato)- start = round(i*spacing*SR)- out[start:start+len(signal)] += signal- # A tiny single delay gives warmth without a long tail or a noisy robot voice.- delay = round(.065*SR)- count = min(len(signal), len(out)-start-delay)- if count > 0:- out[start+delay:start+delay+count] += signal[:count]*.12- return out-audio_bytes = subprocess.check_output([FFMPEG, '-v', 'error', '-i', str(SOURCE),'-t', str(DURATION), '-ar', str(SR), '-ac', '2', '-f', 'f32le', '-'])raw = np.frombuffer(audio_bytes, dtype='<f4').reshape(-1, 2).astype(np.float64)assert len(raw) >= SR*DURATION, len(raw)music = raw[:SR*DURATION] * MUSIC_GAIN-effects = np.zeros_like(music)events = []-def add(time_s, signal, name, peak_db=-8.4, pan=0):- signal = np.asarray(signal, dtype=float)- stereo = signal[:, None] * np.array([math.sqrt((1-pan)/2), math.sqrt((1+pan)/2)])- stereo *= (10**(peak_db/20)) / np.max(np.abs(stereo))- start = round(time_s*SR)- effects[start:start+len(stereo)] += stereo- events.append({'time_seconds': time_s, 'duration_seconds': len(signal)/SR,- 'cue': name, 'cue_peak_dbfs': peak_db, 'pan': pan})--for time_s,pitches in [(3.1,[76,81]),(7.15,[79,84]),(10.2,[72,79]),(14.1,[76,83]),(22.1,[81,86]),(26.65,[76,72]),(30.15,[76,83,88]),(35.1,[79,84,88])]:- add(time_s, phrase(pitches, [.13]*len(pitches), .10, glide=.4), 'soft transition cue', peak_db=-14.0)-envelope = np.ones(len(music))fade_in = round(.5*SR)envelope[:fade_in] = np.sin(np.linspace(0, np.pi/2, fade_in))**2fade_out = round(40.5*SR)envelope[fade_out:] = np.cos(np.linspace(0, np.pi/2, len(music)-fade_out))**2music *= envelope[:,None]-effects *= envelope[:,None]-mix = music + effects+mix = musicpeak = float(np.max(np.abs(mix)))assert peak < 10**(-1/20), f'Less than 1 dB of headroom: {peak}'pcm = np.round(mix*32767).astype('<i2')@@ -92,12 +53,11 @@ report = {'file': str(output), 'duration_seconds': DURATION, 'sample_rate': SR,'music_source': str(SOURCE), 'source_interval_seconds': [0,42],'previous_music_gain': 1.4, 'requested_relative_music_gain': .33,'music_gain': MUSIC_GAIN, 'music_change_db': float(20*np.log10(.33)),- 'music': stats(music), 'effects': stats(effects), 'mix_float': stats(mix),+ 'music': stats(music), 'effects': {'present': False}, 'mix_float': stats(mix),'mix_wav_readback': stats(decoded), 'clipped_samples': int(np.sum(np.abs(pcm.astype(np.int32))>=32767)),'first_sample': pcm[0].tolist(), 'last_sample': pcm[-1].tolist(),'fades_seconds': {'in': [0,.5], 'out': [40.5,42]},- 'effects_original_synthesis': True, 'speech_or_tts': False,- 'sound_family_reference': 'Original electronic cues from the earlier MOSS film',+ 'effects_original_synthesis': False, 'speech_or_tts': False,'events': events, 'sha256': hashlib.sha256(output.read_bytes()).hexdigest()}(ROOT/'AUDIO_QA.json').write_text(json.dumps(report, indent=2)+'\n')print(json.dumps({k:report[k] for k in ['file','duration_seconds','music_gain','mix_wav_readback','clipped_samples']},indent=2))