import sys
import struct
import wave
from math import *
# wav-
WaveF = wave.open( "output.wav" , "wb" )
WaveF.setnchannels(2)
WaveF.setsampwidth(2)
WaveF.setframerate(48000)
WaveF.writeframes( struct .pack( "hh" , 0.5 * 32767.0, 0.5 * 32767.0))
WaveF.close()
* This source code was highlighted with Source Code Highlighter .
import sys
import struct
import wave
from math import *
# wav-
WaveF = wave.open( "output.wav" , "wb" )
WaveF.setnchannels(2)
WaveF.setsampwidth(2)
WaveF.setframerate(48000)
WaveF.writeframes( struct .pack( "hh" , 0.5 * 32767.0, 0.5 * 32767.0))
WaveF.close()
* This source code was highlighted with Source Code Highlighter .
import sys
import struct
import wave
from math import *
# wav-
WaveF = wave.open( "output.wav" , "wb" )
WaveF.setnchannels(2)
WaveF.setsampwidth(2)
WaveF.setframerate(48000)
WaveF.writeframes( struct .pack( "hh" , 0.5 * 32767.0, 0.5 * 32767.0))
WaveF.close()
* This source code was highlighted with Source Code Highlighter .
#
xSize = 0.6 # X
ySize = 0.4 # Y
Dist = 1.5 #
# ,
def PutPoint( x, y, z ):
#
sx = (xSize / 2) + ((x * Dist) / (z + Dist))
sy = (ySize / 2) + ((y * Dist) / (z + Dist))
#
if (sx < -1):
sx = -1;
if (sx > 1):
sx = 1;
if (sy < -1):
sy = -1;
if (sy > 1):
sy = 1;
#
WaveF.writeframes( struct .pack( "hh" , sy * 32767.0, sx * 32767.0))
* This source code was highlighted with Source Code Highlighter .
#
xSize = 0.6 # X
ySize = 0.4 # Y
Dist = 1.5 #
# ,
def PutPoint( x, y, z ):
#
sx = (xSize / 2) + ((x * Dist) / (z + Dist))
sy = (ySize / 2) + ((y * Dist) / (z + Dist))
#
if (sx < -1):
sx = -1;
if (sx > 1):
sx = 1;
if (sy < -1):
sy = -1;
if (sy > 1):
sy = 1;
#
WaveF.writeframes( struct .pack( "hh" , sy * 32767.0, sx * 32767.0))
* This source code was highlighted with Source Code Highlighter .
def DrawCube():
DrawXLine(CPoint(0, 0, 0), CPoint(0.5, 0, 0), 0.0121)
DrawXLine(CPoint(0, 0.5, 0), CPoint(0.5, 0.5, 0), 0.0121)
DrawXLine(CPoint(0, 0, 0.5), CPoint(0.5, 0, 0.5), 0.0121)
DrawXLine(CPoint(0, 0.5, 0.5), CPoint(0.5, 0.5, 0.5), 0.0121)
DrawYLine(CPoint(0, 0, 0), CPoint(0, 0.5, 0), 0.0121)
DrawYLine(CPoint(0.5, 0, 0), CPoint(0.5, 0.5, 0), 0.0121)
DrawYLine(CPoint(0, 0, 0.5), CPoint(0, 0.5, 0.5), 0.0121)
DrawYLine(CPoint(0.5, 0, 0.5), CPoint(0.5, 0.5, 0.5), 0.0121)
DrawZLine(CPoint(0, 0, 0), CPoint(0, 0, 0.5), 0.0121)
DrawZLine(CPoint(0.5, 0, 0), CPoint(0.5, 0, 0.5), 0.0121)
DrawZLine(CPoint(0, 0.5, 0), CPoint(0, 0.5, 0.5), 0.0121)
DrawZLine(CPoint(0.5, 0.5, 0), CPoint(0.5, 0.5, 0.5), 0.0121)
* This source code was highlighted with Source Code Highlighter .
def DrawCube():
DrawXLine(CPoint(0, 0, 0), CPoint(0.5, 0, 0), 0.0121)
DrawXLine(CPoint(0, 0.5, 0), CPoint(0.5, 0.5, 0), 0.0121)
DrawXLine(CPoint(0, 0, 0.5), CPoint(0.5, 0, 0.5), 0.0121)
DrawXLine(CPoint(0, 0.5, 0.5), CPoint(0.5, 0.5, 0.5), 0.0121)
DrawYLine(CPoint(0, 0, 0), CPoint(0, 0.5, 0), 0.0121)
DrawYLine(CPoint(0.5, 0, 0), CPoint(0.5, 0.5, 0), 0.0121)
DrawYLine(CPoint(0, 0, 0.5), CPoint(0, 0.5, 0.5), 0.0121)
DrawYLine(CPoint(0.5, 0, 0.5), CPoint(0.5, 0.5, 0.5), 0.0121)
DrawZLine(CPoint(0, 0, 0), CPoint(0, 0, 0.5), 0.0121)
DrawZLine(CPoint(0.5, 0, 0), CPoint(0.5, 0, 0.5), 0.0121)
DrawZLine(CPoint(0, 0.5, 0), CPoint(0, 0.5, 0.5), 0.0121)
DrawZLine(CPoint(0.5, 0.5, 0), CPoint(0.5, 0.5, 0.5), 0.0121)
* This source code was highlighted with Source Code Highlighter .
def PutPoint( x, y, z ):
global AngleX, AngleY
# Y
nx = x * cos(AngleY) + z * sin(AngleY)
nz = z * cos(AngleY) - x * sin(AngleY)
ny = y;
# X
nnx = nx
nny = ny * cos(AngleX) - nz * sin(AngleX)
nnz = ny * sin(AngleX) + nz * cos(AngleX)
# -
sx = (xSize / 2) + ((nnx * Dist) / (nnz + Dist))
sy = (ySize / 2) + ((nny * Dist) / (nnz + Dist))
if (sx < -1):
sx = -1;
if (sx > 1):
sx = 1;
if (sy < -1):
sy = -1;
if (sy > 1):
sy = 1;
WaveF.writeframes( struct .pack( "hh" , sy * 32767.0, sx * 32767.0))
* This source code was highlighted with Source Code Highlighter .
def PutPoint( x, y, z ):
global AngleX, AngleY
# Y
nx = x * cos(AngleY) + z * sin(AngleY)
nz = z * cos(AngleY) - x * sin(AngleY)
ny = y;
# X
nnx = nx
nny = ny * cos(AngleX) - nz * sin(AngleX)
nnz = ny * sin(AngleX) + nz * cos(AngleX)
# -
sx = (xSize / 2) + ((nnx * Dist) / (nnz + Dist))
sy = (ySize / 2) + ((nny * Dist) / (nnz + Dist))
if (sx < -1):
sx = -1;
if (sx > 1):
sx = 1;
if (sy < -1):
sy = -1;
if (sy > 1):
sy = 1;
WaveF.writeframes( struct .pack( "hh" , sy * 32767.0, sx * 32767.0))
* This source code was highlighted with Source Code Highlighter .
AngleY = 0
AngleX = 0
for cnt in range(0, 1000):
DrawCube()
AngleY += radians(1)
AngleX += radians(1)
* This source code was highlighted with Source Code Highlighter .
AngleY = 0
AngleX = 0
for cnt in range(0, 1000):
DrawCube()
AngleY += radians(1)
AngleX += radians(1)
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/307352/
All Articles