I was tired ...
I need healing. Healing is surely your hometown ... nothing else. Where is our hometown? It's in the PC98 series. Famicom Classic is also selling stupidly. (Although 66 or 88 people seem to be hit, Apple II people should use Virtual II to seek Disk II)
I don't have the actual PC98 anymore ... But even if you don't have an actual machine, you can live with Pipo. Pipo is a beep sound after all, so if you generate it, you can think of your hometown ...
It seems that pygame can generate sounds and make them sound, so if you googled appropriately, someone was doing. Thx! Hometown is near ...
The sound of my hometown seems to be 2000KHz for 100ms, and a little wait for 1000KHz for 100ms. Or rather, this depends on your hometown (maybe it depends on the clock). Yes, there are as many hometowns as there are machines ・ ・ ・
words are not necessary. All I need is a code ... Oh, my hometown is near
pc98.py
from array import array
from time import sleep
import pygame
from pygame.mixer import Sound, get_init, pre_init
class Note(Sound):
def __init__(self, frequency, volume=.1):
self.frequency = frequency
Sound.__init__(self, self.build_samples())
self.set_volume(volume)
def build_samples(self):
period = int(round(get_init()[0] / self.frequency))
samples = array("h", [0] * period)
amplitude = 2 ** (abs(get_init()[1]) - 1) - 1
for time in range(period):
if time < period / 2:
samples[time] = amplitude
else:
samples[time] = -amplitude
return samples
if __name__ == "__main__":
pre_init(44100, -16, 1, 1024)
pygame.init()
Note(2000).play(100)
sleep(0.1)
Note(1000).play(80)
sleep(1)
Install pygame. If it's different from your hometown, change the duration and sleep time after .play by yourself ... I was tired.
$ pip install pygame
$ python pc98.py
I'm back···!
When I returned to my hometown and took a walk in the dusk for a while, I suddenly remembered the girl I admired. It's an old story. I used to go to the sea and space to play with her ... I miss her. I was walking thinking about that.
"Ah, ◯◯ -kun?" Suddenly I was called out, and with that nostalgic quivering voice, I exploded a drum.
Next time, the first love is the taste of BIO_100%. looking forward to
Recommended Posts