commited all contents created by participants
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# -*- coding : utf8 -*-
|
||||
import random
|
||||
|
||||
noise_duration = 50
|
||||
silence_duration = 100
|
||||
variation = 5
|
||||
|
||||
def main():
|
||||
|
||||
# Lire le fichier input.txt et le ranger dans text_in
|
||||
with open("input.txt") as f:
|
||||
text_in = f.read()
|
||||
|
||||
# Parcourir le fichier et effectuer le procédé sur chaque carractere
|
||||
# en fonction de sa place dans le texte. Écrire le résultat dans text_out
|
||||
text_out = ""
|
||||
for i, c in enumerate(text_in):
|
||||
text_out += process(i, c)
|
||||
|
||||
# Écrire le contenu de text_out dans le fichier output.txt
|
||||
with open("output.txt", "w") as f:
|
||||
f.write(text_out)
|
||||
|
||||
|
||||
def process(index, char):
|
||||
# Si je suis dans la période de bruit
|
||||
if index%(noise_duration+silence_duration) < noise_duration:
|
||||
char = random.choice(["v","V","r","R"])
|
||||
return char
|
||||
|
||||
def smooth(position):
|
||||
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user