#!/usr/bin/env python import time import os import sys import pygame from pygame.locals import * import libSBTCVM import libbaltcalc import array #import libtrom import libvmconf synthfreq=int(libvmconf.getconf("audio", "mixrate")) print synthfreq pygame.font.init() #SBTCVM Digital Sample Playback/translation library. def PCMcrunch(datastr, freq): ret=[] for x in datastr: if x=="+": #dividing the mixer rate (synthfreq), by a static value, creates a consistent speed & pitch across mixer rates. #higher divison values=higher pitch make sure each of these has the same value! #divison value==Hz of PCM playback. #3000.0 and -2000.0 are CORRECT. for some odd reason having the + value #be 2000 leaves the left channel silent, but having that and #the - value be -3000 causes clipping... oh well. making note of this. ret.extend([3000.0]*(synthfreq//freq)) if x=="-": ret.extend([-2000.0]*(synthfreq//freq)) if x=="0":
#!/usr/bin/env python import libbaltcalc import pygame import array import math import time import os import libvmconf import libthemeconf mixrate = int(libvmconf.getconf("audio", "mixrate")) #SBTCVM common function library. #SBTCVM Mark 2 #Simple Balanced Ternary Computer Virtual Machine # #v2.0.3 # # Copyright (c) 2016-2018 Thomas Leathers and Contributors # # SBTCVM Mark 2 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SBTCVM Mark 2 is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #
# Copyright (c) 2016-2017 Thomas Leathers and Contributors # # SBTCVM Mark 2 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SBTCVM Mark 2 is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with SBTCVM Mark 2. If not, see <http://www.gnu.org/licenses/> tromlogging = int(libvmconf.getconf("log", "tromlogging")) if tromlogging == 0: logreads = 0 logwrites = 0 if tromlogging == 1: logreads = 1 logwrites = 1 if tromlogging == 1: tromlog1 = open(os.path.join('CAP', "libtrom.log"), "w") def redefA(filenameq): global AROM global TROMA global ROMDICT AROM = {}